package com.itheima.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itheima.Student;
import com.itheima.mapper.StudentMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class StudentServiceImp implements StudentService {
    @Autowired
    private StudentMapper studentMapper;

    @Override
    public void save(Student student) {
        studentMapper.save(student);
    }

    @Override
    public void delete(String number) {
        studentMapper.delete(number);
    }

    @Override
    public void update(Student student) {
        studentMapper.update(student);
    }

    @Override
    public PageInfo<Student> findAll(Integer currentPage, Integer pageSize) {
        PageHelper.startPage(currentPage,pageSize);
        List<Student> list = studentMapper.findAll();
        PageInfo<Student> info = new PageInfo<>(list);
        return info;
    }
}
